package com.luwanglin.eduservice;

import com.luwanglin.eduservice.entity.EduCourseDescription;
import com.luwanglin.eduservice.servicetest.Myservice;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@SpringBootTest
@EnableTransactionManagement
public class testTransactional {
    @Autowired
    Myservice myservice;

    @Test
    void testMyservice() {
        EduCourseDescription eduCourseDescription = new EduCourseDescription();
        eduCourseDescription.setId("112233");
        eduCourseDescription.setDescription("test transactional");
        myservice.test1(eduCourseDescription);
    }

    /*@Test
//    @Transactional
    public void test1() {
        test2();
    }

    @Transactional
    public void test2() {
        EduCourseDescription eduCourseDescription = new EduCourseDescription();
        eduCourseDescription.setId("112233");
        eduCourseDescription.setDescription("test transactional");
        courseDescriptionService.save(eduCourseDescription);
        int i = 1 / 0;
        EduCourseDescription description = courseDescriptionService.getById(eduCourseDescription.getId());
        System.out.println(description);
    }*/
}
